[IA64] Fix ptc.ga emulation bug
authorawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Wed, 28 Feb 2007 17:18:44 +0000 (10:18 -0700)
committerawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Wed, 28 Feb 2007 17:18:44 +0000 (10:18 -0700)
If a vcpu migrates to the local cpu, smp_call_function_single() doesn't
work.  Call ptc_ga_remote_func() directly instead.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
xen/arch/ia64/vmx/vmmu.c

index 901c07bed4ba40a3118f25f6eb55e9f382951f02..6a4ac502c24ead7590bdd0952c1ada489eaa0b43 100644 (file)
@@ -590,6 +590,7 @@ IA64FAULT vmx_vcpu_ptc_ga(VCPU *vcpu, u64 va, u64 ps)
     struct domain *d = vcpu->domain;
     struct vcpu *v;
     struct ptc_ga_args args;
+    int proc;
 
     args.vadr = va;
     vcpu_get_rr(vcpu, va, &args.rid);
@@ -599,20 +600,21 @@ IA64FAULT vmx_vcpu_ptc_ga(VCPU *vcpu, u64 va, u64 ps)
             continue;
 
         args.vcpu = v;
-        if (v->processor != vcpu->processor) {
-            int proc;
+again: /* Try again if VCPU has migrated.  */
+        proc = v->processor;
+        if (proc != vcpu->processor) {
             /* Flush VHPT on remote processors.  */
-            do {
-                proc = v->processor;
-                smp_call_function_single(v->processor, 
-                    &ptc_ga_remote_func, &args, 0, 1);
-                /* Try again if VCPU has migrated.  */
-            } while (proc != v->processor);
-        }
-        else if(v == vcpu)
+            smp_call_function_single(v->processor,
+                                     &ptc_ga_remote_func, &args, 0, 1);
+            if (proc != v->processor)
+                goto again;
+        } else if (v == vcpu) {
             vmx_vcpu_ptc_l(v, va, ps);
-        else
+        } else {
             ptc_ga_remote_func(&args);
+            if (proc != v->processor)
+                goto again;
+        }
     }
     return IA64_NO_FAULT;
 }